# -*- coding: utf-8 -*-

from django import forms

from models import Place

class PlaceCommentForm(forms.Form):
    """
    Form for submit comment in place page
    """
    comment = forms.CharField(
            label=u'评论',
            widget=forms.Textarea(attrs={'size':64,'value':u'有话要说'})
            )

    photo = forms.ImageField(
            label=u'图片',
            required=False,
            widget=forms.FileInput(attrs={'size':16})
            )                                              

class PlaceForm(forms.Form):
    """
    Form for submit place
    """
    country = forms.CharField(
            #label=u'国家',
            widget=forms.HiddenInput(attrs={'size':32,'value':u'国家'})
            )

    region = forms.CharField(
            #label=u'地区',
            widget=forms.HiddenInput(attrs={'size':32,'value':u'地区'})
            )

    city = forms.CharField(
            #label=u'城市',
            widget=forms.HiddenInput(attrs={'size':32,'value':u'城市'})
            )

    district = forms.CharField(
            #label=u'区域',
            widget=forms.HiddenInput(attrs={'size':32,'value':u'区域'})
            )                    
    name = forms.CharField(
            label=u'名称',
            widget=forms.TextInput(attrs={'size':16,'value':u'名称'})
            )

    address = forms.CharField(
            label=u'地址',
            widget=forms.TextInput(attrs={'size':28,'value':u'地址'})
            )

    latitude = forms.CharField(
            widget=forms.HiddenInput()
            )

    longitude = forms.CharField(
            widget=forms.HiddenInput()
            )

    genre = forms.CharField(
            label=u'类型:',
            widget=forms.Select(choices=Place.PLACE_GENRE),
            )

    description = forms.CharField(
            label=u'简介',
            required=False,
            widget=forms.Textarea(attrs={'size':64,'value':u'说点什么'})
            )

    tags = forms.CharField(
            label=u'标签',
            required=False,
            widget=forms.TextInput(attrs={'size':28,'value':u'标签 请用空格分开'})
            )

    image = forms.ImageField(
            label=u'图片',
            required=False,
            widget=forms.FileInput(attrs={'size':8})
            )

    def __unicode__(self):
        return u'%s, %s, %s, %s, %s, %s' % (
                self.name
               ,self.address
               ,self.latitude
               ,self.longitude
               ,self.genre
               ,self.description
               ,self.tags
               )
